package service

import (
	"gin/common"
	"gin/common/constant"
	"gin/common/db/config"
	util "gin/common/util"
	sysEntity "gin/system/entity"
	"github.com/gin-gonic/gin"
)

func GetRoleList(c *gin.Context) {
	restlist := make([]*sysEntity.SysRole, 0)
	roleErr := config.GormDb.Model(&sysEntity.SysRole{}).Table("sys_role ").
		Select("role_id", "role_name", "role_key", "role_sort", "data_scope", "menu_check_strictly",
			"dept_check_strictly", "status", "del_flag", "create_time", "remark", "update_time").
		Where("LOWER(1) = LOWER(?)", 1).Scan(&restlist).Error
	if roleErr != nil {
		common.ReturnError(c, constant.ERRORCODE(), constant.ERRORMSG()+",错误详细信息为： "+util.MapToJson(restlist), "", int64(len("")))
		panic("")
	}
	common.ReturnListSucess(c, constant.SUCCESSCODE(), constant.SUCCESSMSG(), restlist, int64(len(restlist)))
}
